<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <title>北京站网格化系统</title>
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <link rel="stylesheet" href="../lib/css/iconFont/iconfont.css">
    <link rel="stylesheet" href="../lib/css/common.css">
    <link rel="stylesheet" href="../lib/css/station.css">
    <script src="../lib/js/jquery.1.10.1.js"></script>
    <script src="../lib/js/base.js"></script>
    <style>
        .passwordBgc{
            margin-bottom: 0px;
        }
        .login_tip{
            height: 0.5rem;
            color: #49e2ff;
            text-align: right;
            line-height: 1rem;
            padding-right: 1rem;
            box-sizing: border-box;
            margin-bottom: 1rem;
            margin-top: 1rem;
            width: 32rem;
        }
    </style>
</head>
<body class="station_login">
<div class="station_grid_login">
    <div class="station_login_title">
        <h1>北京站智能网格化</h1>
        <h1>管理系统</h1>
    </div>
    <div class="station_login_right">
        <p class="station_login_loginTit">密码登录</p>
        <input class="station_login_input countBgc" name='user_name' type="text" placeholder="账号"/>
        <input class="station_login_input passwordBgc"  name="user_pass" type="password" placeholder="密码"/>
        <p class="login_tip"></p>
        <button  class="station_login_right_btn" type="submit">登录</button>
        
        <!-- <p class="station_login_forget"><a href="changePass.html">忘记密码？</a></p> -->
    </div>
    <!-- <div class="link_A">
        <a href="http://10.78.153.164:14136/download/chrome_forXP.exe">XP系统点此下载谷歌浏览器</a>
        <a href="http://10.78.153.164:14136/download/Chrome.exe">Win7及以上系统点此下载谷歌浏览器</a>
    </div> -->
</div>
<script>
$(function(){
/*    
    //验证账户
    $('input[name=user]').blur(function(){
        $forgetPassword.find(".inputtips").remove();

        //用户名验证
        if( $(this).is('input[name=userphon]') ){
            if( this.value=="" || ( this.value!="" &&!/^[1][2,3,4,5,6,7,8,9][0-9]{9}$/.test($(this).val())) ){
                $forgetPassword.append('<span class="inputtips forget_password-tips">请输入至少11位的手机号.</span>').css('color','coral');
            }else{
                $forgetPassword.append('<span class="inputtips forget_password-tips"></span>');
            }
        }
        //密码验证
        if( $(this).is('input[type=password]') ){
            if( this.value=="" || ( this.value!="" && !/[a-zA-Z]{1,5}[0-9]{2,5}$/.test(this.value)) ){
                $forgetPassword.append('<span class="inputtips forget_password-tips">请以字母开头数字混合最少6位.</span>').css('color','coral');
            }else{
                $forgetPassword.append('<span class="inputtips forget_password-tips"></span>');
            }
        }
    })
*/
    //提交(需要接口)
    $('.station_login_right_btn').on('click',function(){
        var user_name = $("input[name ='user_name']").val();
        var user_pass = $("input[name ='user_pass']").val();
        $.ajax({
            url:serverUrl.base+serverUrl.login,
            type:'post',
            data:{
                user_account:user_name,
                user_pwd:user_pass
            },
            dataType:"json",
            success:function(msg){
                if(msg.code==0){
                    msg.data.ids='0'
                    storageControl.setStorageS(msg.data)
                    var _powers = msg.data.power.split(',')
                    if(_powers.some(function(v){return v == '1'})){
                        window.location.href='./home.html';
                    }else{
                        alert('该帐号没有查看网格系统的权限，请更换帐号登录')
                    }
                    
                }else{
                    $('.login_tip').text(msg.info)
                    console.log(msg.info);
                }
            }
        })
    })
    // 提交勿删
    $("input[name=user_name]").keydown(function() {
        if (event.keyCode == "13") {
            $('.station_login_right_btn').click();
        }
    });
    $("input[name=user_pass]").keydown(function() {
        if (event.keyCode == "13") {
            $('.station_login_right_btn').click();
        }
    });
})

</script>
</body>
</html>